package com.jkc.xh.views.headview;

import android.content.Context;
import android.content.Intent;
import android.support.v4.app.FragmentActivity;
import android.util.AttributeSet;
import android.widget.RelativeLayout;

import com.jkc.xh.R;
import com.jkc.xh.activities.WebActivity_;
import com.jkc.xh.constants.Constant;
import com.jkc.xh.fragments.AutoListFragment_;
import com.jkc.xh.fragments.BalFragment_;
import com.jkc.xh.fragments.HaltSellListFragment_;
import com.jkc.xh.fragments.HistoryBussinessFragment_;
import com.jkc.xh.fragments.MoneyBillFragment_;
import com.jkc.xh.fragments.MoreFunctionFragment_;
import com.jkc.xh.fragments.MyFactoryFragment_;
import com.jkc.xh.fragments.MyMoneyFragment_;
import com.jkc.xh.fragments.RevokeOrderFragment_;
import com.jkc.xh.fragments.TodayBussinessFragment_;
import com.jkc.xh.fragments.TodayWeituoFragment_;
import com.jkc.xh.fragments.TradeAutoBuyFragment_;
import com.jkc.xh.fragments.TradeAutoSellFragment_;
import com.jkc.xh.fragments.TradeBuyFragment_;
import com.jkc.xh.fragments.TradeSoldAllFragment_;
import com.jkc.xh.fragments.TradeSoldPartFragment_;
import com.jkc.xh.utils.CacheTools;

import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EViewGroup;

/**
 * Created by zhangbreeze on 2015/11/13.
 */
@EViewGroup(R.layout.function_page_two)
public class HomePageView2 extends RelativeLayout {


    private FragmentActivity fg;

    public HomePageView2(Context context) {
        this(context, null);
        fg = (FragmentActivity) context;
    }

    public HomePageView2(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Click(R.id.function_buy)
    void openTradeBuy() {
        TradeBuyFragment_.builder().build().startFragment(fg);
    }


    @Click(R.id.function_weituo)
    void openDodayWeituo() {
        TodayWeituoFragment_.builder().build().startFragment(fg);
    }

    @Click(R.id.function_cancel)
    void openRevokeOrder() {
        RevokeOrderFragment_.builder().build().startFragment(fg);
    }

    @Click(R.id.function_more)
    void openMoreFunction() {
        MoreFunctionFragment_.builder().build().startFragment(fg);
    }

    @Click(R.id.function_sold)
    void openOrderSoldPart() {
        TradeSoldPartFragment_.builder().build().startFragment(fg);
    }

    @Click(R.id.function_sold_all)
    void openOrderSoldAll() {
        TradeSoldAllFragment_.builder().build().startFragment(fg);
    }

    @Click(R.id.function_my_factory)
    void openMyFactory() {
        MyFactoryFragment_.builder().build().startFragment(fg);
    }

    @Click(R.id.function_money_bill)
    void openMoneyBill() {
        MoneyBillFragment_.builder().build().startFragment(fg);
    }

    @Click(R.id.function_my_money)
    void openMyMoney() {
        MyMoneyFragment_.builder().build().startFragment(fg);
    }

    @Click(R.id.function_today_deal)
    void openTodayBussiness() {
        TodayBussinessFragment_.builder().build().startFragment(fg);
    }

    @Click(R.id.function_order_history)
    void openHistoryBussiness() {
        HistoryBussinessFragment_.builder().build().startFragment(fg);
    }


    @Click(R.id.function_bal)
    void openBal() {
        BalFragment_.builder().build().startFragment(fg);
    }

    @Click(R.id.function_auto_buy)
    void autoBuy() {
        TradeAutoBuyFragment_.builder().build().startFragment(fg);
    }

    @Click(R.id.function_auto_sold)
    void autoSold() {
        TradeAutoSellFragment_.builder().build().startFragment(fg);
    }

    @Click(R.id.function_auto_list)
    void autoList() {
        AutoListFragment_.builder().build().startFragment(fg);
    }

    @Click(R.id.haltSellList)
    void haltSellList() {
        HaltSellListFragment_.builder().build().startFragment(fg);
    }

    @Click(R.id.function_black_list)
    void blackList() {
        Intent intent = new Intent(fg, WebActivity_.class);
        intent.putExtra(Constant.ACTION_AD_URL, CacheTools.getPageUrl()+"/Index/Nest/black.html");
        fg.startActivity(intent);
    }
}
